
import os
import shutil
from utils.LogHandler import log
from conf import  settings
class Bar(object):

    def rm(self, file_path_list):
        """  删除文件或者文件夹"""
        for i in file_path_list:
            try:
                if os.path.isdir(i):
                    shutil.rmtree(i)
                else:
                    os.remove(i)
                log.info('删除成功: {}'.format(i.replace(settings.BASE_DIR, '').strip('/').strip('\\')))
            except FileNotFoundError as e:
                log.info('不存在的文件或者目录: {}'.format(i))
if __name__ == '__main__':
    Bar().rm([r'D:\mydata\demo\ATScripts\allure_report.zip', r'D:\mydata\demo\ATScripts\allure-report'])